package preprocess;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ArticleUnit {
	private String pmid;
	private String title;
	private String abstract_info;
	private List<String> Mesh;
	private List<String> majorMesh;
	private List<Name> author_names;
	private String journal;
	private String Cold_Sentence;
	private List<String> bigram_profile;
	public ArticleUnit(){
		pmid = null;
		title = null;
		abstract_info = null;
		setMesh(new ArrayList<String>());
		setAuthor_names(new ArrayList<Name>());
		setJournal(null);
		Cold_Sentence = null;
		bigram_profile = new ArrayList<String>();
	}

	public String getPmid() {
		return pmid;
	}

	public void setPmid(String pmid) {
		this.pmid = pmid;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAbstract_info() {
		return abstract_info;
	}

	public void setAbstract_info(String abstract_info) {
		this.abstract_info = abstract_info;
	}

	public List<String> getMesh() {
		return Mesh;
	}

	public void setMesh(List<String> mesh) {
		Mesh = new ArrayList<String>();
		for(String m: mesh)
			Mesh.add(m);
	}

	public List<String> getMajorMesh() {
		return majorMesh;
	}

	public void setMajorMesh(List<String> majorMesh) {
		majorMesh = new ArrayList<String>();
		for(String m: majorMesh)
			this.majorMesh.add(m);
	}

	public List<Name> getAuthor_names() {
		return author_names;
	}

	public void setAuthor_names(List<Name> author_names) {
		this.author_names = new ArrayList<Name>();
		for(Name author_name: author_names){
			this.author_names.add(author_name);
			}
	}

	public String getJournal() {
		return journal;
	}

	public void setJournal(String journal) {
		this.journal = journal;
	}

	public String getCold_Sentence() {
		return Cold_Sentence;
	}

	public void setCold_Sentence() {
		Text_Clean cleanser = new Text_Clean();
		if(title.toLowerCase().contains("cold"))
			Cold_Sentence = cleanser.GetColdSentence_Tokenizer_StopWordRemoval(title);
		if(abstract_info.toLowerCase().contains("cold"))
			Cold_Sentence += " "+ cleanser.GetColdSentence_Tokenizer_StopWordRemoval(abstract_info);
	}

	public List<String> getBigram_profile() {
		return bigram_profile;
	}

	public void setBigram_profile(String local) {
		HashMap<String,Integer> bigrams = new HashMap<String,Integer>();
			local = local.trim();
			String s[] = local.split(" ");
			if(s.length==3){
				if(!bigrams.containsKey(s[0].toLowerCase()+" cold")){
					bigrams.put(s[0].toLowerCase()+" cold", bigrams.size());
					bigram_profile.add(s[0].toLowerCase()+" cold");
				}
				if(!bigrams.containsKey("cold "+s[2].toLowerCase())){
					bigrams.put("cold "+s[2].toLowerCase(), bigrams.size());
					bigram_profile.add("cold "+s[2].toLowerCase());
				}
			}
			else if(s.length==2)
				if(!bigrams.containsKey(local.toLowerCase())){
					bigrams.put(local.toLowerCase(), bigrams.size());
					bigram_profile.add(local.toLowerCase());
				}
	}
}
